<div class="modal-body">
    <form method="post" id="frmSearch" action="<?= base_url() ?>company/popup/">
        <div class="span5">
            <div class="row">
                <div class="span1">Nama</div>
                <input type="text" name="txtSearch" class="span3" id="txtSearch" value="<?= @$txtSearch ?>"/>
                <input type="submit" class="btn-primary" value="Cari"/>
            </div>
        </div>
    </form>
    <table class="table table-bordered table-striped responsive-utilities">
        <thead>
            <tr>
                <th>Nama</th>
                <th>Alamat</th>
                <th>Descr</th>
            </tr>
        </thead>
        <tbody>
            <? if (@$dt): ?>
                <? foreach ($dt as $k => $v): ?>
                    <tr onclick="setCompany('<?= $v->company_id ?>','<?= $v->company_name ?>')">
                        <td><?= $v->company_name ?></td>
                        <td><?= $v->company_address ?>, <?= getNamaKota($v->city_id) ?>, <?= getNamaPropinsi($v->province_id) ?></td>
                        <td><?= $v->company_description ?></td>
                    </tr>
                <? endforeach; ?>
                <? if ($this->paginationpopup->create_links() <> "") : ?>
                    <tr>
                        <th colspan="3" style="text-align: center;"><?php echo $this->paginationpopup->create_links(); ?></th>
                    </tr>
                <? endif; ?>
            <? else: ?>
                <tr>
                    <td colspan="3">Data perusahaan tidak ditemukan.</td>
                </tr>
            <? endif; ?>
        </tbody>
    </table>
</div>
<div class="modal-footer">
    <a href="#" class="btn btn-inverse" data-dismiss="modal">Batal</a>
    <input type="button" class="btn-primary" onclick="addCompany()" value="Tambah Perusahaan"/>
</div>
<script>
    $("#frmSearch").submit(function(event) {
        event.preventDefault();
        var $form = $( this ),
        url = $form.attr( 'action' );
        console.log($form.serialize());
        $.post(url, $form.serialize(),
        function(data){
            $('#free').html(data);
        });
    });
    function pageClick(page){
        var action = $("#frmSearch").attr("action");
        $("#frmSearch").attr("action", action + page);
        $("#frmSearch").submit();
    };
    $(".modal").css({
        'width' : '940',
        'margin-top':($(window).height()-$(".modal").height())/2, 
        'top':'0',
        'margin-left':($(window).width()-940)/2, 
        'left' : '0'
    }) ;
</script>